<!DOCTYPE html>
<html lang="zc-CN">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

    <script>
        //构造函数
        function Star(uname, age) {
            this.uname = uname
            this.age = age
        }
        //公共方法写到原型对象身上，节约内存
        Star.prototype.sing = function () {
            console.log('唱歌');
        }
        const ldh = new Star('刘德华', 30)
        console.log(ldh.__proto__ === Star.prototype)//返回true
        console.log(ldh.__proto__.__proto__ === Object.prototype)//返回true
    </script>
</body>

</html>